package cn.ibizlab.odoo.core.odoo_stock.service.impl;

import java.io.Serializable;
import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.HashMap;
import java.math.BigInteger;
import java.util.Collection;

import lombok.extern.slf4j.Slf4j;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.cglib.beans.BeanCopier;
import org.springframework.stereotype.Service;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.PageImpl;
import org.springframework.data.domain.Pageable;
import cn.ibizlab.odoo.core.client.model.Istock_picking;
import cn.ibizlab.odoo.core.odoo_stock.domain.Stock_picking;
import cn.ibizlab.odoo.core.odoo_stock.filter.Stock_pickingSearchContext;
import cn.ibizlab.odoo.core.odoo_stock.service.IStock_pickingService;
import cn.ibizlab.odoo.util.SearchResult;
import cn.ibizlab.odoo.util.log.IBIZLog;

/**
 * 实体[调拨] 服务对象接口实现
 */
@Slf4j
@IBIZLog
@Service
public class Stock_pickingServiceImpl implements IStock_pickingService {

    @Autowired
    private cn.ibizlab.odoo.core.client.service.Istock_pickingClientService stock_pickingClientService;

    @Override
    public Stock_picking get(Integer id) {
        Istock_picking clientModel = stock_pickingClientService.createModel();
        clientModel.setId(id);
        stock_pickingClientService.get(clientModel) ;
        return this.convert2Domain(clientModel,null);
    }

    @Override
    public Stock_picking get(Stock_picking stock_picking) {
        Stock_picking retstock_picking = this.get(stock_picking.getId()) ;
    	BeanCopier copier=BeanCopier.create(retstock_picking.getClass(), stock_picking.getClass(), false);
        copier.copy(retstock_picking, stock_picking, null);
        return stock_picking ;
    }

    @Override
    public boolean remove(Integer id) {
        boolean bOk = false ;
        Istock_picking clientModel = stock_pickingClientService.createModel();
        clientModel.setId(id);
        stock_pickingClientService.remove(clientModel) ;
        bOk = true ;
        return bOk ;
    }

    @Override
    public void updateBatch(List<Stock_picking> stock_pickings, int batchSize) {

        //stock_pickingClientService.updateBatch(stock_pickings,batchSize) ;

    }

    @Override
    public boolean update(Stock_picking stock_picking) {
        boolean bOk = false ;
        Istock_picking clientModel = this.convert2Model(stock_picking,null);
        stock_pickingClientService.update(clientModel) ;
        this.convert2Domain(clientModel,stock_picking) ;
        bOk = true;
        return bOk ;
    }

    @Override
    public void createBatch(List<Stock_picking> stock_pickings, int batchSize) {

                        //stock_pickingClientService.createBatch(stock_pickings,batchSize) ;

    }

    @Override
    public void removeBatch(Collection<? extends Serializable> idList, int batchSize) {

        //stock_pickingClientService.removeBatch(stock_pickings) ;

    }

    @Override
    public boolean create(Stock_picking stock_picking) {
        boolean bOk = false ;
        Istock_picking clientModel = this.convert2Model(stock_picking,null);
        stock_pickingClientService.create(clientModel) ;
        this.convert2Domain(clientModel,stock_picking);
        bOk = true ;

        return bOk ;
    }

    /**
     * 查询集合 默认查询
     */
    @Override
    public Page<Stock_picking> searchDefault(Stock_pickingSearchContext context) {
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());
    }


    /**
     * 根据公司查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_company(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_owner(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据联系人查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_partner(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_create(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据用户查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_write(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据销售订单查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_sale(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存位置查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_location_dest(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据库存位置查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_location(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据拣货类型查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_picking_type(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }

    /**
     * 根据调拨查询
     */
    @Override
    public Page<Stock_picking> selectByOdoo_backorder(Integer id){
        Stock_pickingSearchContext context = new Stock_pickingSearchContext();
        if(!org.springframework.util.StringUtils.isEmpty(id)){
            cn.ibizlab.odoo.util.SearchFieldFilter fieldFilter=new cn.ibizlab.odoo.util.SearchFieldFilter();
            fieldFilter.setParam("id");
            fieldFilter.setCondition(cn.ibizlab.odoo.util.enums.SearchFieldType.EQ);
            fieldFilter.setValue(id);
            context.getCondition().add(fieldFilter);
        }
        List<Stock_picking> list = new ArrayList<Stock_picking>();
        Page<cn.ibizlab.odoo.core.client.model.Istock_picking> clientModelList = stock_pickingClientService.search(context) ;
        for(cn.ibizlab.odoo.core.client.model.Istock_picking clientModel : clientModelList){
            list.add( this.convert2Domain(clientModel,null));
        }
        return new PageImpl<Stock_picking>(list, context.getPageable(), clientModelList.getTotalElements());

    }



    public Istock_picking convert2Model(Stock_picking domain , Istock_picking model) {
        if(domain == null)
            return model ;
        if(model==null){
            model = stock_pickingClientService.createModel() ;
        }

         if(domain.getPackage_level_idsDirtyFlag())
            model.setPackage_level_ids(domain.getPackage_level_ids());
         if(domain.getNoteDirtyFlag())
            model.setNote(domain.getNote());
         if(domain.getWebsite_idDirtyFlag())
            model.setWebsite_id(domain.getWebsite_id());
         if(domain.getActivity_type_idDirtyFlag())
            model.setActivity_type_id(domain.getActivity_type_id());
         if(domain.getPrintedDirtyFlag())
            model.setPrinted(domain.getPrinted());
         if(domain.getMessage_needaction_counterDirtyFlag())
            model.setMessage_needaction_counter(domain.getMessage_needaction_counter());
         if(domain.getProduct_idDirtyFlag())
            model.setProduct_id(domain.getProduct_id());
         if(domain.getMessage_partner_idsDirtyFlag())
            model.setMessage_partner_ids(domain.getMessage_partner_ids());
         if(domain.getMessage_unread_counterDirtyFlag())
            model.setMessage_unread_counter(domain.getMessage_unread_counter());
         if(domain.getMove_typeDirtyFlag())
            model.setMove_type(domain.getMove_type());
         if(domain.getBackorder_idsDirtyFlag())
            model.setBackorder_ids(domain.getBackorder_ids());
         if(domain.getMessage_needactionDirtyFlag())
            model.setMessage_needaction(domain.getMessage_needaction());
         if(domain.getMessage_idsDirtyFlag())
            model.setMessage_ids(domain.getMessage_ids());
         if(domain.getHas_packagesDirtyFlag())
            model.setHas_packages(domain.getHas_packages());
         if(domain.getOriginDirtyFlag())
            model.setOrigin(domain.getOrigin());
         if(domain.getIs_lockedDirtyFlag())
            model.setIs_locked(domain.getIs_locked());
         if(domain.getShow_operationsDirtyFlag())
            model.setShow_operations(domain.getShow_operations());
         if(domain.getGroup_idDirtyFlag())
            model.setGroup_id(domain.getGroup_id());
         if(domain.getMessage_has_error_counterDirtyFlag())
            model.setMessage_has_error_counter(domain.getMessage_has_error_counter());
         if(domain.getMove_line_ids_without_packageDirtyFlag())
            model.setMove_line_ids_without_package(domain.getMove_line_ids_without_package());
         if(domain.getActivity_date_deadlineDirtyFlag())
            model.setActivity_date_deadline(domain.getActivity_date_deadline());
         if(domain.getActivity_user_idDirtyFlag())
            model.setActivity_user_id(domain.getActivity_user_id());
         if(domain.getActivity_stateDirtyFlag())
            model.setActivity_state(domain.getActivity_state());
         if(domain.getActivity_idsDirtyFlag())
            model.setActivity_ids(domain.getActivity_ids());
         if(domain.getIdDirtyFlag())
            model.setId(domain.getId());
         if(domain.getActivity_summaryDirtyFlag())
            model.setActivity_summary(domain.getActivity_summary());
         if(domain.getMessage_has_errorDirtyFlag())
            model.setMessage_has_error(domain.getMessage_has_error());
         if(domain.getMove_line_idsDirtyFlag())
            model.setMove_line_ids(domain.getMove_line_ids());
         if(domain.getPackage_level_ids_detailsDirtyFlag())
            model.setPackage_level_ids_details(domain.getPackage_level_ids_details());
         if(domain.getMessage_unreadDirtyFlag())
            model.setMessage_unread(domain.getMessage_unread());
         if(domain.getDateDirtyFlag())
            model.setDate(domain.getDate());
         if(domain.getDate_doneDirtyFlag())
            model.setDate_done(domain.getDate_done());
         if(domain.getHas_trackingDirtyFlag())
            model.setHas_tracking(domain.getHas_tracking());
         if(domain.getMessage_main_attachment_idDirtyFlag())
            model.setMessage_main_attachment_id(domain.getMessage_main_attachment_id());
         if(domain.getStateDirtyFlag())
            model.setState(domain.getState());
         if(domain.getImmediate_transferDirtyFlag())
            model.setImmediate_transfer(domain.getImmediate_transfer());
         if(domain.getHas_scrap_moveDirtyFlag())
            model.setHas_scrap_move(domain.getHas_scrap_move());
         if(domain.getMove_ids_without_packageDirtyFlag())
            model.setMove_ids_without_package(domain.getMove_ids_without_package());
         if(domain.getCreate_dateDirtyFlag())
            model.setCreate_date(domain.getCreate_date());
         if(domain.getShow_validateDirtyFlag())
            model.setShow_validate(domain.getShow_validate());
         if(domain.getNameDirtyFlag())
            model.setName(domain.getName());
         if(domain.getMessage_channel_idsDirtyFlag())
            model.setMessage_channel_ids(domain.getMessage_channel_ids());
         if(domain.getDisplay_nameDirtyFlag())
            model.setDisplay_name(domain.getDisplay_name());
         if(domain.getPriorityDirtyFlag())
            model.setPriority(domain.getPriority());
         if(domain.getMove_linesDirtyFlag())
            model.setMove_lines(domain.getMove_lines());
         if(domain.getPurchase_idDirtyFlag())
            model.setPurchase_id(domain.getPurchase_id());
         if(domain.getWrite_dateDirtyFlag())
            model.setWrite_date(domain.getWrite_date());
         if(domain.getWebsite_message_idsDirtyFlag())
            model.setWebsite_message_ids(domain.getWebsite_message_ids());
         if(domain.getShow_mark_as_todoDirtyFlag())
            model.setShow_mark_as_todo(domain.getShow_mark_as_todo());
         if(domain.getMessage_follower_idsDirtyFlag())
            model.setMessage_follower_ids(domain.getMessage_follower_ids());
         if(domain.getMove_line_existDirtyFlag())
            model.setMove_line_exist(domain.getMove_line_exist());
         if(domain.getMessage_attachment_countDirtyFlag())
            model.setMessage_attachment_count(domain.getMessage_attachment_count());
         if(domain.get__last_updateDirtyFlag())
            model.set__last_update(domain.get__last_update());
         if(domain.getScheduled_dateDirtyFlag())
            model.setScheduled_date(domain.getScheduled_date());
         if(domain.getMessage_is_followerDirtyFlag())
            model.setMessage_is_follower(domain.getMessage_is_follower());
         if(domain.getShow_check_availabilityDirtyFlag())
            model.setShow_check_availability(domain.getShow_check_availability());
         if(domain.getShow_lots_textDirtyFlag())
            model.setShow_lots_text(domain.getShow_lots_text());
         if(domain.getWrite_uid_textDirtyFlag())
            model.setWrite_uid_text(domain.getWrite_uid_text());
         if(domain.getBackorder_id_textDirtyFlag())
            model.setBackorder_id_text(domain.getBackorder_id_text());
         if(domain.getPicking_type_id_textDirtyFlag())
            model.setPicking_type_id_text(domain.getPicking_type_id_text());
         if(domain.getPartner_id_textDirtyFlag())
            model.setPartner_id_text(domain.getPartner_id_text());
         if(domain.getCreate_uid_textDirtyFlag())
            model.setCreate_uid_text(domain.getCreate_uid_text());
         if(domain.getLocation_id_textDirtyFlag())
            model.setLocation_id_text(domain.getLocation_id_text());
         if(domain.getLocation_dest_id_textDirtyFlag())
            model.setLocation_dest_id_text(domain.getLocation_dest_id_text());
         if(domain.getPicking_type_codeDirtyFlag())
            model.setPicking_type_code(domain.getPicking_type_code());
         if(domain.getPicking_type_entire_packsDirtyFlag())
            model.setPicking_type_entire_packs(domain.getPicking_type_entire_packs());
         if(domain.getOwner_id_textDirtyFlag())
            model.setOwner_id_text(domain.getOwner_id_text());
         if(domain.getSale_id_textDirtyFlag())
            model.setSale_id_text(domain.getSale_id_text());
         if(domain.getCompany_id_textDirtyFlag())
            model.setCompany_id_text(domain.getCompany_id_text());
         if(domain.getPicking_type_idDirtyFlag())
            model.setPicking_type_id(domain.getPicking_type_id());
         if(domain.getSale_idDirtyFlag())
            model.setSale_id(domain.getSale_id());
         if(domain.getLocation_dest_idDirtyFlag())
            model.setLocation_dest_id(domain.getLocation_dest_id());
         if(domain.getCreate_uidDirtyFlag())
            model.setCreate_uid(domain.getCreate_uid());
         if(domain.getPartner_idDirtyFlag())
            model.setPartner_id(domain.getPartner_id());
         if(domain.getOwner_idDirtyFlag())
            model.setOwner_id(domain.getOwner_id());
         if(domain.getWrite_uidDirtyFlag())
            model.setWrite_uid(domain.getWrite_uid());
         if(domain.getCompany_idDirtyFlag())
            model.setCompany_id(domain.getCompany_id());
         if(domain.getLocation_idDirtyFlag())
            model.setLocation_id(domain.getLocation_id());
         if(domain.getBackorder_idDirtyFlag())
            model.setBackorder_id(domain.getBackorder_id());
        return model ;
    }

    public Stock_picking convert2Domain( Istock_picking model ,Stock_picking domain) {
        if(model == null)
            return domain ;
        if(domain == null){
            domain = new Stock_picking();
        }

        if(model.getPackage_level_idsDirtyFlag())
            domain.setPackage_level_ids(model.getPackage_level_ids());
        if(model.getNoteDirtyFlag())
            domain.setNote(model.getNote());
        if(model.getWebsite_idDirtyFlag())
            domain.setWebsite_id(model.getWebsite_id());
        if(model.getActivity_type_idDirtyFlag())
            domain.setActivity_type_id(model.getActivity_type_id());
        if(model.getPrintedDirtyFlag())
            domain.setPrinted(model.getPrinted());
        if(model.getMessage_needaction_counterDirtyFlag())
            domain.setMessage_needaction_counter(model.getMessage_needaction_counter());
        if(model.getProduct_idDirtyFlag())
            domain.setProduct_id(model.getProduct_id());
        if(model.getMessage_partner_idsDirtyFlag())
            domain.setMessage_partner_ids(model.getMessage_partner_ids());
        if(model.getMessage_unread_counterDirtyFlag())
            domain.setMessage_unread_counter(model.getMessage_unread_counter());
        if(model.getMove_typeDirtyFlag())
            domain.setMove_type(model.getMove_type());
        if(model.getBackorder_idsDirtyFlag())
            domain.setBackorder_ids(model.getBackorder_ids());
        if(model.getMessage_needactionDirtyFlag())
            domain.setMessage_needaction(model.getMessage_needaction());
        if(model.getMessage_idsDirtyFlag())
            domain.setMessage_ids(model.getMessage_ids());
        if(model.getHas_packagesDirtyFlag())
            domain.setHas_packages(model.getHas_packages());
        if(model.getOriginDirtyFlag())
            domain.setOrigin(model.getOrigin());
        if(model.getIs_lockedDirtyFlag())
            domain.setIs_locked(model.getIs_locked());
        if(model.getShow_operationsDirtyFlag())
            domain.setShow_operations(model.getShow_operations());
        if(model.getGroup_idDirtyFlag())
            domain.setGroup_id(model.getGroup_id());
        if(model.getMessage_has_error_counterDirtyFlag())
            domain.setMessage_has_error_counter(model.getMessage_has_error_counter());
        if(model.getMove_line_ids_without_packageDirtyFlag())
            domain.setMove_line_ids_without_package(model.getMove_line_ids_without_package());
        if(model.getActivity_date_deadlineDirtyFlag())
            domain.setActivity_date_deadline(model.getActivity_date_deadline());
        if(model.getActivity_user_idDirtyFlag())
            domain.setActivity_user_id(model.getActivity_user_id());
        if(model.getActivity_stateDirtyFlag())
            domain.setActivity_state(model.getActivity_state());
        if(model.getActivity_idsDirtyFlag())
            domain.setActivity_ids(model.getActivity_ids());
        if(model.getIdDirtyFlag())
            domain.setId(model.getId());
        if(model.getActivity_summaryDirtyFlag())
            domain.setActivity_summary(model.getActivity_summary());
        if(model.getMessage_has_errorDirtyFlag())
            domain.setMessage_has_error(model.getMessage_has_error());
        if(model.getMove_line_idsDirtyFlag())
            domain.setMove_line_ids(model.getMove_line_ids());
        if(model.getPackage_level_ids_detailsDirtyFlag())
            domain.setPackage_level_ids_details(model.getPackage_level_ids_details());
        if(model.getMessage_unreadDirtyFlag())
            domain.setMessage_unread(model.getMessage_unread());
        if(model.getDateDirtyFlag())
            domain.setDate(model.getDate());
        if(model.getDate_doneDirtyFlag())
            domain.setDate_done(model.getDate_done());
        if(model.getHas_trackingDirtyFlag())
            domain.setHas_tracking(model.getHas_tracking());
        if(model.getMessage_main_attachment_idDirtyFlag())
            domain.setMessage_main_attachment_id(model.getMessage_main_attachment_id());
        if(model.getStateDirtyFlag())
            domain.setState(model.getState());
        if(model.getImmediate_transferDirtyFlag())
            domain.setImmediate_transfer(model.getImmediate_transfer());
        if(model.getHas_scrap_moveDirtyFlag())
            domain.setHas_scrap_move(model.getHas_scrap_move());
        if(model.getMove_ids_without_packageDirtyFlag())
            domain.setMove_ids_without_package(model.getMove_ids_without_package());
        if(model.getCreate_dateDirtyFlag())
            domain.setCreate_date(model.getCreate_date());
        if(model.getShow_validateDirtyFlag())
            domain.setShow_validate(model.getShow_validate());
        if(model.getNameDirtyFlag())
            domain.setName(model.getName());
        if(model.getMessage_channel_idsDirtyFlag())
            domain.setMessage_channel_ids(model.getMessage_channel_ids());
        if(model.getDisplay_nameDirtyFlag())
            domain.setDisplay_name(model.getDisplay_name());
        if(model.getPriorityDirtyFlag())
            domain.setPriority(model.getPriority());
        if(model.getMove_linesDirtyFlag())
            domain.setMove_lines(model.getMove_lines());
        if(model.getPurchase_idDirtyFlag())
            domain.setPurchase_id(model.getPurchase_id());
        if(model.getWrite_dateDirtyFlag())
            domain.setWrite_date(model.getWrite_date());
        if(model.getWebsite_message_idsDirtyFlag())
            domain.setWebsite_message_ids(model.getWebsite_message_ids());
        if(model.getShow_mark_as_todoDirtyFlag())
            domain.setShow_mark_as_todo(model.getShow_mark_as_todo());
        if(model.getMessage_follower_idsDirtyFlag())
            domain.setMessage_follower_ids(model.getMessage_follower_ids());
        if(model.getMove_line_existDirtyFlag())
            domain.setMove_line_exist(model.getMove_line_exist());
        if(model.getMessage_attachment_countDirtyFlag())
            domain.setMessage_attachment_count(model.getMessage_attachment_count());
        if(model.get__last_updateDirtyFlag())
            domain.set__last_update(model.get__last_update());
        if(model.getScheduled_dateDirtyFlag())
            domain.setScheduled_date(model.getScheduled_date());
        if(model.getMessage_is_followerDirtyFlag())
            domain.setMessage_is_follower(model.getMessage_is_follower());
        if(model.getShow_check_availabilityDirtyFlag())
            domain.setShow_check_availability(model.getShow_check_availability());
        if(model.getShow_lots_textDirtyFlag())
            domain.setShow_lots_text(model.getShow_lots_text());
        if(model.getWrite_uid_textDirtyFlag())
            domain.setWrite_uid_text(model.getWrite_uid_text());
        if(model.getBackorder_id_textDirtyFlag())
            domain.setBackorder_id_text(model.getBackorder_id_text());
        if(model.getPicking_type_id_textDirtyFlag())
            domain.setPicking_type_id_text(model.getPicking_type_id_text());
        if(model.getPartner_id_textDirtyFlag())
            domain.setPartner_id_text(model.getPartner_id_text());
        if(model.getCreate_uid_textDirtyFlag())
            domain.setCreate_uid_text(model.getCreate_uid_text());
        if(model.getLocation_id_textDirtyFlag())
            domain.setLocation_id_text(model.getLocation_id_text());
        if(model.getLocation_dest_id_textDirtyFlag())
            domain.setLocation_dest_id_text(model.getLocation_dest_id_text());
        if(model.getPicking_type_codeDirtyFlag())
            domain.setPicking_type_code(model.getPicking_type_code());
        if(model.getPicking_type_entire_packsDirtyFlag())
            domain.setPicking_type_entire_packs(model.getPicking_type_entire_packs());
        if(model.getOwner_id_textDirtyFlag())
            domain.setOwner_id_text(model.getOwner_id_text());
        if(model.getSale_id_textDirtyFlag())
            domain.setSale_id_text(model.getSale_id_text());
        if(model.getCompany_id_textDirtyFlag())
            domain.setCompany_id_text(model.getCompany_id_text());
        if(model.getPicking_type_idDirtyFlag())
            domain.setPicking_type_id(model.getPicking_type_id());
        if(model.getSale_idDirtyFlag())
            domain.setSale_id(model.getSale_id());
        if(model.getLocation_dest_idDirtyFlag())
            domain.setLocation_dest_id(model.getLocation_dest_id());
        if(model.getCreate_uidDirtyFlag())
            domain.setCreate_uid(model.getCreate_uid());
        if(model.getPartner_idDirtyFlag())
            domain.setPartner_id(model.getPartner_id());
        if(model.getOwner_idDirtyFlag())
            domain.setOwner_id(model.getOwner_id());
        if(model.getWrite_uidDirtyFlag())
            domain.setWrite_uid(model.getWrite_uid());
        if(model.getCompany_idDirtyFlag())
            domain.setCompany_id(model.getCompany_id());
        if(model.getLocation_idDirtyFlag())
            domain.setLocation_id(model.getLocation_id());
        if(model.getBackorder_idDirtyFlag())
            domain.setBackorder_id(model.getBackorder_id());
        return domain ;
    }


}
